﻿$(document).ready(function() {
    $('.tabs > li').hover(
        function() {
            if ($(this).hasClass('selected'))
                return;
            $(this).addClass('hover');
        },
        function() {
            if ($(this).hasClass('selected'))
                return;
            $(this).removeClass('hover');
        });
    $('#info').click(function() {
        $('.tabs > li').removeClass('selected');
        $(this).parent().removeClass('hover');
        $(this).parent().addClass('selected');
        var url = $(this).attr('href');
        $.getJSON(url, renderInfo);
        return false;
    });
});
function renderInfo(person) {
    result = "<h3 class=\"title\">Basic Information</h3>";
    result += "<div class=\"block\">";
    result += "<p class=\"field\">Sex: <span>" + person.sex + "</span></p>";
    result += "<p class=\"field\">Birthdate: <span>" + person.birthdate + "</span></p>";
    result += "</div>"
    result += "<h3 class=\"title\">Contact Information</h3>";
    result += "<div class=\"block\">";
    result += "<p class=\"field\">Email: <span><a href=\"mailto:" + person.email + "\">" + person.email + "</a></span></p>";
    result += "<p class=\"field\">Faculty: <span>" + person.duties.facultyName + "</span></p>";
    result += "<p class=\"field\">Department: <span>" + person.duties.departmentName + "</span></p>";
    result += "<p class=\"field\">Group: <span>" + person.duties.groupName + "</span></p>";
    result += "</div>"
    $('.content-container').html(result);
}